package com.frank.utils;

import org.springframework.http.converter.StringHttpMessageConverter;

public class PathUtils {
    private static String separator = System.getProperty("file.separator");

    /**
     * 返回项目图片的根路径
     *
     * @return
     */
    public static String getImgBathPath() {
        String os = System.getProperty("os.name");
        String basePath = "";
        if (os.toLowerCase().startsWith("win")) {
            basePath = "D:/javaStudy/projectdev/imgs/";
        } else {
            basePath = "/home/frank/projectdev/imgs/";
        }
        basePath = basePath.replace("/", separator);
        return basePath;
    }

    /**
     * 根据商铺Id返回上传图片的路径
     *
     * @param shopId
     * @return
     */
    public static String getShopImagePath(long shopId) {
        String imagePath = "upload/item/shop/" + shopId + "/";
        return imagePath.replace("/", separator);
    }
}
